<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>register</title>
    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
</head>
<body>
<div class="row clearfix" style="width: 400px;margin: auto;margin-top: 20px">
    <div class="col-md-12 column">
        <form role="form">
            <div class="form-group">
                <label>用户名称：</label><input type="text" class="form-control" id="username" />
            </div>
            <div class="form-group">
                <label>用户密码：</label><input type="text" class="form-control" id="password" />
            </div>
            <div class="form-group">
                <label>联系电话：</label><input type="text" class="form-control" id="tel" />
            </div>
            <button id="addUser" style="width: 100px" type="button" class="btn btn-success">注册</button>
            <button id="back" style="width: 100px;margin-left: 20px" onclick="backLogin()" type="button" class="btn btn-info">返回</button>
        </form>
    </div>
</div>

</body>
<script>
    $(document).ready(function () {
        $("#addUser").click(function () {
            var param = {
                username: $("#username").val(),
                password: $("#password").val(),
                tel: $("#tel").val()
            }
            $.ajax({
                type: 'POST',
                url: "http://49.235.107.34:8081/user/register",
                data: param,
                success: function (result) {
                    if (result.code == 0) {
                        alert("修改成功,请返回登录")
                    } else {
                        alert("修改失败，请重试")
                    }
                }
            });
        });
    });
    function backLogin() {
        window.location.assign("http://49.235.107.34:8081/login.html")
    }
</script>
</html>